package net.sdd.ucc.exception;

import com.sun.org.apache.regexp.internal.RE;
import net.sdd.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(BusinessException.class)
    public Result handleBusinessException(BusinessException e){
        return Result.fail().code(e.getCode()).message(e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e){
        return Result.fail();
    }
}
